package com.yangke.springcloud.service;

import com.yangke.springcloud.entites.CommonResult;
import com.yangke.springcloud.entites.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")  // 告诉openFeign应该在eureka中使用哪个服务名的接口
public interface PaymentFeignService {
    // 直接在接口层中调用payment中的get请求的方法，省去了restTemplate，
    // 可以直接通过OpenFeign调用需要使用的http请求，减少了代码的冗余
    @GetMapping(value = "/payment/getPayment/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);
}
